package com.shisfish.english.controller;

import java.util.List;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSON;
import com.shisfish.core.controller.BaseController;
import com.shisfish.core.dto.ResultDto;
import com.shisfish.english.model.Category;

@Controller
@RequestMapping(value = "category", produces = "application/json; charset=utf-8")
public class CategoryController extends BaseController {
	
	@ResponseBody
	@RequestMapping(value = "/{parent}/parent")
	public String searchByParams(@PathVariable("parent") Long parent, String name) {
		ResultDto<List<Category>> resultDto = categoryService.selectByParams(parent, name);
		return JSON.toJSONString(resultDto);
	}

}
